import Vue from "vue";
import VueRouter from "vue-router";
import Recommend from "@views/Recommend/Recommend";
import Singer from "@views/Singer/Singer";
import Search from "@views/Search/Search";
import Rank from "@views/Rank/Rank";
import Detail from "@views/Detail/Detail";
Vue.use(VueRouter);

const routes = [
  {
    path: "/recommend",
    name: "recommend",
    component: Recommend,
  },
  {
    path: "/singer",
    name: "singer",
    component: Singer,
    children: [
      {
        path: "detail/:id",
        component: Detail,
      },
    ],
  },
  {
    path: "/rank",
    name: "rank",
    component: Rank,
  },
  {
    path: "/search",
    name: "search",
    component: Search,
  },
  {
    path: "/",
    redirect: "/recommend",
  },
];

const router = new VueRouter({
  // mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
